/*
 * @Author: 大D
 * @email: 857216393@qq.com
 * @Date: 2024-01-16 11:38:24
 * @Description: 博文相关接口
 */
//引入
import http from '@/apis/request/http';
import type { Res, IBlog, IPagination, IComment, ICommentInfo } from './type';
export const addBlog = (params: IBlog) => {
  return http<Res>({
    url: '/blog/_token/add',
    method: 'post',
    data: params
  });
};
export const updateBlog = (params: IBlog) => {
  return http<Res>({
    url: '/blog/_token/update',
    method: 'put',
    data: params
  });
};
export const topBlog = (params: IBlog) => {
  return http<Res>({
    url: '/blog/_token/top',
    method: 'put',
    data: params
  });
};
export const likeBlog = (params: IBlog) => {
  return http<Res>({
    url: '/blog/like',
    method: 'put',
    data: params
  });
};
export const deleteBlog = (params: IBlog) => {
  return http<Res>({
    url: '/blog/_token/delete',
    method: 'delete',
    data: params
  });
};
export const getBlogList = (params: IPagination) => {
  return http<Res>({
    url: '/blog/search',
    method: 'get',
    cancel: false,
    data: params
  });
};
export const getBlogDetail = (params: IBlog) => {
  return http<Res>({
    url: '/blog/detail',
    method: 'get',
    data: params
  });
};
export const upLoadImg = (params: any) => {
  return http<Res>({
    url: '/upload/rich_editor_upload',
    method: 'post',
    cancel: false,
    data: params
  });
};
export const addComment = (params: IComment) => {
  return http<Res>({
    url: '/comment/addComment',
    method: 'post',
    data: params
  });
};
export const getCommentList = (params: IPagination) => {
  return http<Res<ICommentInfo>>({
    url: '/comment/commentList',
    method: 'get',
    data: params
  });
};
export const getCommentChildList = (params: IPagination) => {
  return http<Res>({
    url: '/comment/commentChildList',
    method: 'get',
    data: params
  });
};
